package com.csyaonie.kotlin

import kotlin.math.max

fun main(){
    println("hello kotlin");
    val a=10
    val b=9
    val c= maxNumber(a,b)
    val d= largerNumber(a,b)
    println(c)
    println(d)
    println(getScore("Tom"))
    checkNumber(5)
    checkNumber(5.5)
    for (i in 0..10) println(i)
    println("====")
    for (i in 0 until 10 step 1) println(i)
    println("====")
    for (i in 10 downTo  0 step 1) println(i)
}

fun maxNumber(a:Int,b:Int):Int= max(a,b)

fun largerNumber(a:Int,b:Int)=if(a>b) a else b

fun getScore(name:String)= when (name){
    "Tom"->63
    "Jim"->77
    "jack"->90
    else -> 0
}
fun getScore2(name:String)= when{
    name=="Tom"->63
    name=="Jim"->77
    name=="jack"->90
    else -> 0
}

fun checkNumber(num:Number){
    when (num){
        is Int -> println("number is Int")
        is Double -> println("number id Double")
        else -> println(" number not support")
    }
}
